<template>
  <div style="display: inline-block;">
    <el-select v-model="sVal" filterable :placeholder="$t('请选择')" clearable>
      <el-option v-for="item in list" :key="item.value" :label="$t(item.label)" :value="item.value" />
    </el-select>
  </div>

</template>
<script>
export default {
  name: 'Conditions',
  props: {
    type: {
      type: String,
      default: () => ''
    },
    value: {
      type: [String, Number, Date, Object],
      default: ''
    }
  },
  data() {
    return {
      sVal: this.value,
      list: []
    }
  },
  watch: {
    sVal(val) {
      this.$emit('input', val)
    },
    value(val) {
      this.sVal = val
    },
    type(val) {
      this.list = []
      var arr = [
        { label: '等于', value: 'HDY' },
        { label: '不等于', value: 'BDY' },
        { label: '包含', value: 'BH' },
        { label: '不包含', value: 'BBH' },
        { label: '为空', value: 'WK' },
        { label: '不为空', value: 'BWH' }
      ]
      var row = [
        { label: '大于', value: 'DY' },
        { label: '大于等于', value: 'DYDY' },
        { label: '小于', value: 'XY' },
        { label: '小于等于', value: 'XYDY' }
      ]
      var SJN = [
        { label: '多少天之内', value: 'SJN' }
      ]
      if (val === 'JE') {
        this.list = [...arr, ...row]
      } else if (val === 'RQ') {
        this.list = [...arr, ...row, ...SJN]
      } else {
        this.list = arr
      }
    }
  }

}
</script>
